{template 'common/header'}
<div class="main">
	<ul class="nav nav-tabs">
		<li>
			<a href="{php echo $this->createWebUrl('datimanage');}">答题管理</a>
		</li>
		<li>
			<a href="{php echo $this->createWebUrl('adddati');}">添加答题</a>
		</li>
		<li class="active">
			<a href="{php echo $this->createWebUrl('importdati',array('rid'=>$rid));}">导入题库</a>
		</li>
	</ul>
<div class="panel panel-default">
	<div class="panel-body">
    <form enctype="multipart/form-data" method="post" action="{php echo $this->createWebUrl('import')}">
		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2  control-label"><span style='color:red'>*</span>题库excel</label>
			<div class="col-sm-10">
				<div class="input-group ">
					<input type="hidden" name="rid" value="{$rid}" />
					<input type="text" id="excelpath" name="excelpath" value="" class="form-control" autocomplete="off">
					<span class="input-group-btn">
						<button class="btn btn-default" type="button" id="selectbtn">选择文件</button><input type="file" name="excelfile" id="selectfile" onchange="fileChange(this);" style="display:none">
					</span>
					
				</div>
				<span><a href="{MODULE_URL}resource/excel/model.xls" style="font-size:16px;color:red;text-decoration:underline;">下载模板</a></span>
			</div>		
		</div>
		
		<div class="form-group">
			<div class="col-sm-12">
				<input name="submit" type="submit" value="提交" class="btn btn-primary col-lg-1">
			</div>
		</div>
		</form>
	</div>
</div>	
<script>
$("#selectbtn").click(function(){
	return $("#selectfile").click();
})
function fileChange(target){
	$("#excelpath").val(target.value);
    var name=target.value;
    var fileName = name.substring(name.lastIndexOf(".")+1).toLowerCase();
    if(fileName !="xls" && fileName !="xlsx"){
        alert("请选择execl格式文件上传！");
        target.value="";
        return
    }
}
</script>
</div>
{template 'common/footer'}